package cn.itcast.controller;

import cn.itcast.dao.UserRepository;
import cn.itcast.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by luoshupeng on 2018-03-20 10:35
 */
@RestController
@RequestMapping("/user/*")
public class UserController {

    @Autowired
    private UserRepository userRepository;

    @GetMapping("findOne")
    public User findOne(){
//        try {
//            Thread.sleep(2000L);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        User byId = userRepository.findById(1);
        System.out.println(byId);
        return byId;
    }


}
